package com.elm.service.impl;

import com.elm.dao.DeliveryAddressDao;
import com.elm.entity.DeliveryAddress;
import com.elm.service.DeliveryAddressService;

import java.sql.SQLException;
import java.util.List;

public class DeliveryAddressServiceImpl implements DeliveryAddressService {
    private final DeliveryAddressDao dao;
    public DeliveryAddressServiceImpl() {
        dao = new DeliveryAddressDao();
    }
    @Override
    public int saveAddress(DeliveryAddress deliveryAddress) throws SQLException {
        return dao.doSaveAddress(deliveryAddress);
    }

    @Override
    public int updateAddress(DeliveryAddress deliveryAddress) throws SQLException {
        return dao.doUpdateAddress(deliveryAddress);
    }

    @Override
    public int deleteAddress(int daId) {
        return dao.doDeleteAddress(daId);
    }

    @Override
    public DeliveryAddress getAddressById(int daId) {
        return dao.doGetAddressById(daId);
    }

    @Override
    public List<DeliveryAddress> getAddressList(String userId) {
        return dao.doGetAddressList(userId);
    }
}